package ro.cityprojects.adminloc.entities;

import javax.persistence.*;

/**
 * PersonAssociation class
 *
 * @author bogdan.solga
 *
 * Date: 13.06.2013, time: 17:47
 */
@javax.persistence.IdClass(ro.cityprojects.adminloc.entities.PersonAssociationPK.class)
@javax.persistence.Table(name = "PERSON_ASSOCIATION")
@Entity
public class PersonAssociation {

    @Id
    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "ASSOCIATION_ID", referencedColumnName = "ASSOCIATION_ID", nullable = false)
    private Association associationByAssociationId;

    @Id
    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "PERSON_ID", referencedColumnName = "PERSON_ID", nullable = false)
    private Person personByPersonId;

    public Association getAssociationByAssociationId() {
        return associationByAssociationId;
    }

    public void setAssociationByAssociationId(Association associationByAssociationId) {
        this.associationByAssociationId = associationByAssociationId;
    }

    public Person getPersonByPersonId() {
        return personByPersonId;
    }

    public void setPersonByPersonId(Person personByPersonId) {
        this.personByPersonId = personByPersonId;
    }

    /*
    @javax.persistence.Column(name = "PERSON_ID", nullable = false, insertable = true, updatable = true, length = 0, precision = -127)
    private Integer personId;

    public Integer getPersonId() {
        return personId;
    }

    public void setPersonId(Integer personId) {
        this.personId = personId;
    }

    @javax.persistence.Column(name = "ASSOCIATION_ID", nullable = false, insertable = true, updatable = true, length = 0, precision = -127)
    private Integer associationId;

    public Integer getAssociationId() {
        return associationId;
    }

    public void setAssociationId(Integer associationId) {
        this.associationId = associationId;
    }
    */
}
